﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="sys_userpwd_edit.aspx.cs" Inherits="Ccit.SysPlat.Organ.sys_userpwd_edit" %>
<html>
<head runat="server">
    <title>用户口令修改页面</title>
    <script language="javascript" src="../script/jquery.js" type="text/javascript"></script>
    <script type="text/javascript">
    <!--
        function checkform(oOrigin,oConfirm,oNew) {            
            if(jQuery.trim(oOrigin.value) == "") {
                alert("原始口令不能为空!");
                oOrigin.focus();
                return false;
            }            
            
            if(jQuery.trim(oNew.value) == "") {
                alert("新口令不能为空!");
                oNew.focus();
                return false;
            }

            if (/[^\x00-\xff]/g.test(jQuery.trim(oNew.value))) {
                alert("口令中不能包含汉字!");
                oNew.focus();
                return false;
            }
            
            if(jQuery.trim(oNew.value) != jQuery.trim(oConfirm.value)) {
                alert("新口令与确认口令不符!");
                oConfirm.focus();
                return false;
            }           
            return true;
            
        }
        function doConfirm() {
            var vUserId = $get("_hidUserId").value;
            var vUserType = $get("_hidUserType").value;
            var oOrigin = $get("txtOrigin");
            var oConfirm = $get("txtConfirm");
            var oNew = $get("txtNew");
            if(!checkform(oOrigin,oConfirm,oNew)) return;
            
            PageMethods.ModifyPwd(vUserType,vUserId,jQuery.trim(oOrigin.value),jQuery.trim(oNew.value),ClientCallBack);            
        }

        function ClientCallBack(vResult) {
            if (null == vResult || vResult == "undefined") {
                alert("网络传输错误,没有正确的返回值,请检查网络是否畅通!");
                return;
            }
            eval("var resultObj=" + vResult);
            var operType = resultObj.OPERTYPE;
            switch (operType) {
                case "PWDMODIFY":
                    alert(resultObj.RSTMSG);
                    if (parseInt(resultObj.RSTSIGN) > 0) {
                        window.close();
                    }
                    else {
                        $get("txtOrigin").focus();
                    }
                    break;
            }
            resultObj = null;        
        }
        
        function doClose() {
            window.close();
        }
    //-->
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <input type="hidden" id="_hidUserId" runat="server" />
    <input type="hidden" id="_hidUserType" runat="server" />
    <asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" runat="server"></asp:ScriptManager>
        <table class="tbToolbar" cellpadding="0" cellspacing="0" width="98%" align="center">
            <tr>
                <td align="left">
                    <div class="tbSeparator"></div>
                </td>
                <td width="100%" class="titlebar">
                    用户口令修改
                </td>
                <td align="right">
                    <div class="tbSeparatorEnd"></div>
                </td>
            </tr>   
        </table>
        <table class="tableborder" cellpadding="0" cellspacing="0" width="98%" align="center">
            <tr>
                <td class="pformleft" width="10%" align="right"><nobr>原始口令:</nobr></td>
                <td class="pformright" align="left">
                    <input type="password" id="txtOrigin"  class="input" style="width:98%" /> 
                </td>                
            </tr>            
            <tr>
                <td class="pformleft" width="10%" align="right"><nobr>新口令:</nobr></td>
                <td class="pformright" align="left">
                    <input type="password" id="txtNew" class="input" style="width:98%" /> 
                </td>                
            </tr>
            <tr>
                <td class="pformleft" width="10%" align="right"><nobr>口令确认:</nobr></td>
                <td class="pformright" align="left">
                    <input type="password" id="txtConfirm" class="input" style="width:98%" /> 
                </td>                
            </tr>
            <tr class="pformstrip">
                <td colspan="2" align="center">
                    <input type="button" id="btnConfirm" value="确认" class="button" onclick="doConfirm()" />
                    &nbsp;
                    <input type="button" id="btnClose" value="关闭" class="button" onclick="doClose()" />
                </td>
            </tr>
        </table>
        
    </form>
</body>
</html>
